<?php
# runphp Mediawiki Extension


# <php> phpcode; </php>

# To activate the extension, include it from your LocalSettings.php
# with: include("extensions/runphp.php");


$wgExtensionFunctions[] = "wfRunPHP";

function wfRunPHP() {
global $wgParser;
$wgParser->setHook( "php", "parsePHP" );
}


function parsePHP( $input, $argv) {
ob_start();
eval($input);
$output = ob_get_contents();
ob_end_clean();
return $output;
}
?>